<script src="../js/getParameter.js"/>
<script src="../js/jquery.min.js"/>
<script type="text/javascript" src="../js/main.js"/>

<script>
    //入口函数
    $(function () {
        $.getJSON("../user/getLoginInfo.do", {}, function (data) { //获得登录的用户
            var str = "";
            var btnLogin = $("#btn_login");
            var hello = $("#hello");
            if (data != null) { //已登录
                str = "<li><a class=\"on\" href=\"index.html\">商城首页</a></li>" +
                    "<li>" +
                    "<a href=\"myInfo.html\">个人信息</a>" +
                    "</li>" +
                    "<li>" +
                    "<a href=\"myOrder.html?uid=" + data.uid + "\">我的订单</a>" +
                    "</li>" +
                    "<li>" +
                    "<a href=\"address.html?uid=" + data.uid + "\">收货地址</a>" +
                    "</li>" +
                    "<li>" +
                    "<a href=\"shopcart.html?uid=" + data.uid + "\">购物车</a>" +
                    "</li>" +
                    "<li>" +
                    "<form>" +
                    "<input  id='bname' type=\"text\" placeholder=\"请输入书名关键字...\">" +
                    "<input id='btn_bname' type=\"button\" value=\"搜索\">" +
                    "</form>" +
                    "</li>";
                hello.text("欢迎回来~" + data.name + "!");
                btnLogin.attr("href", "../user/logout.do");
                btnLogin.text("退出登录");
            } else {
                str = "<li><a class=\"on\" href=\"index.html\">商城首页</a></li>" +
                    "<li>" +
                    "<a href=\"XXX/\" target=\"_blank\">购物车</a>" +
                    "</li>" +
                    "<li>" +
                    "<form>" +
                    "<input id='bname' type=\"text\" placeholder=\"请输入书名关键字...\">" +
                    "<input id='btn_bname' type=\"submit\" value=\"搜索\">" +
                    "</form>" +
                    "</li>"
                btnLogin.attr("href", "../user/login.do");
                hello.text("欢迎来到波克书城~");
                btnLogin.text("请先登录");
            }
            $("#top_nav").html(str);
            $("#btn_bname").click(function () {
                var bname = $("#bname").val();
                load(1, j_btype, bname);
            });
        });
    });
</script>
<header id="header">
    <div class="topbar-wrap white">
        <div class="topbar-inner clearfix">
            <div class="topbar-logo-wrap clearfix">
                <h1 class="topbar-logo none"><a href="index.html" class="navbar-brand">后台管理</a></h1>
                <ul class="navbar-list clearfix" id="top_nav">

                </ul>
            </div>
            <div class="top-info-wrap">
                <ul class="top-info-list clearfix">
                    <li><span id="hello">欢迎光临波克书城~</span></li>
                    <li><a href="#" id="btn_login"></a></li>
                </ul>
            </div>
        </div>
    </div>
</header>